<template>
  <div class="mine">
    <van-nav-bar
      title="个人中心"
      left-text="饿了么"
      right-text=". . ."
      left-arrow
      @click-left="$router.back()"
    />
    <div class="btn_login">
      <span class="login" @click="goLogin">登录</span>
      <span class="login" @click="goRegister">注册</span>
    </div>
    <div class="tool">
      <h2>常用工具</h2>
      <div class="card">
        <div v-for="(item,index) in cardList" :key="index" @click="$router.push(item.to)">
          <van-icon :name="item.icon" />
          <span>{{item.name}}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      cardList:[
        {
          icon:"location-o",
          name:"我的地址",
          to:"/home"
        },
        {
          icon:"service-o",
          name:"我的客服",
          to:"/home"
        },
        {
          icon:"like-o",
          name:"店铺关注",
          to:"/collection"
        },
        {
          icon:"star-o",
          name:"评价有礼",
          to:"/home"
        }

      ]
    }
  },
  methods: {
    goLogin() {
      this.$router.push("/login");
    },
    goRegister() {
      this.$router.push("/register");
    },
  },
};
</script>

<style lang="scss" scoped>
.mine {
  background-color: #eee;
  .btn_login {
    margin: 0 15px;
    display: flex;
    justify-content: space-between;
    .login {
      background: #999;
      padding: 3px 8px;
      border-radius: 5px;
    }
  }
  .tool{
    margin: 30px 15px;
    background-color: white;
    box-sizing: border-box;
    padding: 15px;
    border-radius: 10px;
    h2{
      font-size: 18px;
      margin-bottom: 15px;
    }
    .card{
      display: flex;
      justify-content: space-around;
      div{
        display: flex;
        flex-direction: column;
        align-items: center;
        i{
          font-size: 24px;
          font-weight: bold;
          margin-bottom: 5px;
        }
        span{
          font-size: 14px;
        }
      }
    }
  }
}
</style>